package com.google.code.ojar.sendtemplatemail.app.resendhandler;



import com.google.code.ojar.sendtemplatemail.app.resendhandler.imp.ResendDefaultFactory;


/**
 * Abstract factory that generate an instance of {@link ResendHandler}<br>
 * To instanciate a new object of this class, use the method {@link ResendHandler.getInstance}
 * @author ottoabreu
 *
 */
public abstract class ResendFactory {

	/**
	 * Method that return a instance of {@link ResendHandler} from the property file.<br>
	 * The property sendMail.properties must have in the key <b>resend.mail.folder</b> a valid class that extends from {@link ResendHandler}<br>
	 * If the value is blank or the property key is missing, this value returns an instance of {@link XmlHandler}
	 * @return ResendHandler
	 * @throws ClassCastException if the given class is not an instance of {@link ResendHandler}
	 * @throws Exception if can't instantiate the Handler class
	 * 
	 */
	public abstract ResendHandler gethandler()throws Exception;
	
	/**
	 * this method returns a new instance of this factory
	 * @return {@link ResendFactory}
	 */
	public static ResendFactory getInstance()  {
		
		return new ResendDefaultFactory();
	}
	/**
	 * Returns a new factory from the given class name<br>
	 * Could throw a {@link NotImplementedException} if this method was not implemented by the concrete factory
	 * @param factoryClassName  String must be the qualify Name of the class (package.ClassName)
	 * @return ResendFactory
	 */
	public abstract ResendFactory getInstance(String factoryClassName)throws Exception;


}
